<?php
// +----------------------------------------------------------------------
// | QSCMS
// +----------------------------------------------------------------------
// | Copyright (c)  2025 https://www.qqss.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed QSCMS is not free software, commercial use must purchase official license from official website to avoid unnecessary legal disputes.
// +----------------------------------------------------------------------
// | Author: Contract 990504246@qq.com
// +----------------------------------------------------------------------

namespace app\adminapi\validate\user;

use app\adminapi\validate\Base;

class LevelValidate extends Base
{
    protected $rule = [
        'id'         => 'require',
        'name'       => 'require|max:50',
        'min_points' => 'require|number|egt:0',
        'max_points' => 'require|number|egt:0',
        'icon'       => 'max:255',
        'status'     => 'in:0,1',
    ];

    protected $message = [
        'id.require'         => 'id_required',
        'name.require'       => 'name_required',
        'name.max'           => 'name_max',
        'min_points.require' => 'min_points_required',
        'min_points.number'  => 'min_points_number',
        'min_points.egt'     => 'min_points_egt',
        'max_points.require' => 'max_points_required',
        'max_points.number'  => 'max_points_number',
        'max_points.egt'     => 'max_points_egt',
        'icon.max'           => 'icon_max',
        'status.in'          => 'status_in',
    ];

    public function sceneAdd()
    {
        return $this->only(['name', 'min_points', 'max_points', 'icon', 'status']);
    }

    public function sceneEdit()
    {
        return $this->only(['id', 'name', 'min_points', 'max_points', 'icon', 'status']);
    }

    public function sceneStatus()
    {
        return $this->only(['id', 'status']);
    }
}